<?php 

namespace Acme\ContestBundle\Form;
 
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;

class ContestManageType extends AbstractType
{
    public function buildForm(FormBuilder $builder, array $options)
    {    	
    	$builder->add('contestType', 'contestTypeSelector');
    	$builder->add('reviewType', 'contestReviewType');
    	$builder->add('applyState', 'contestApplyState');
    	$builder->add('flag', 'flag');
    	
    	if (in_array('ROLE_SUPER_ADMIN', $options['role'])) {
    		$builder->add('university', 'universitySelector');
    	}
    }
    
    // the name of the class that holds the underlying data(for use of function createForm)
    public function getDefaultOptions(array $options)
    {
    	return array(
    			'required' => false,
    			'role' => $options['role'],
    	);
    }
    
    // note that the getName() method should return a unique identifier for this form "type"
    public function getName()
    {
    	return 'contest_manage';
    }
}